Python 설치

Python 정보

Python의 종류

  • CPython
    • C 구현
  • jython
    • Java 구현
  • IronPython
    • .NET 구현
  • PyPy
    • python JIT
  • Pyston
    • LLVM

Python의 버전

  • 버전 표기법
    • major.minor.micro
  • Major 버전
    • version 2
      • 현재 최신 버전 2.7.11
      • 더 이상의 신규 마이너 버전 없음
    • version 3
      • 현재 최신 버전 3.5.1
      • version 2와 하위 호환 없음
  • 버전간 차이
    • 문자열 저장
      • version 2는 문자열을 바이너리 형태로 저장, version 3는 유니코드 포인트로 변환하여 저장
    • 문법 차이
      • print 명령, 나누기 연산자(division operator) 등

기본 Python 설치

  • Python을 사용할 수 있는 최소의 설치
  • 기본적으로 인터프리터(interpreter)만 설치
  • https://www.python.org/downloads/
  • 실제로는 사용하지 않는다.

Python 배포판(Distrubutions)

  • 인터프리터 및 패키지(라이브러리), 패키지 관리 시스템, 콘솔(console), 강화된 인터프리터(enhanced interpreter) 등을 포함

  • 배포판의 종류

    • ActiveState ActivePython (commercial and community versions, including scientific computing modules)
    • pythonxy (Scientific-oriented Python Distribution based on Qt and Spyder)
    • winpython (WinPython is a portable scientific Python distribution for Windows)
    • Conceptive Python SDK (targets business, desktop and database applications)
    • Enthought Canopy (a commercial distribution for scientific computing)
    • PyIMSL Studio (a commercial distribution for numerical analysis – free for non-commercial use)
    • eGenix PyRun (a portable Python runtime, complete with stdlib, frozen into a single 3.5MB - 13MB executable file)
    • Anaconda Python (a full Python distribution for data management, analysis and visualization of large data sets)

Continuum Anaconda

  • 가장 후발 주자 (Travis Oliphant 2012년 설립)
  • 2015년 현재 사실상의 표준(de facto standard)
  • 모든 플랫폼(Windows/Linux/Mac 32/64bit)에 대해 완벽한 패키지 제공
  • 모든 플랫폼에 대해 오픈 소스, 무료
  • 기업용 유지 보수 서비스 동시 제공
  • 기업 빅데이터용 특수 패키지 개발 및 판매

Anaconda 배포판 다운로드 및 설치

설치 완료

  • Windows 시스템의 경우

설치 확인

conda 패키지 관리자


In [1]:
conda --version


conda 4.0.5

In [2]:
conda list


# packages in environment at /home/joel/anaconda2:
#
abstract-rendering        0.5.1               np110py27_0  
alabaster                 0.7.7                    py27_0  
anaconda-client           1.4.0                    py27_0  
anaconda                  custom                   py27_0  
anaconda-navigator        1.1.0                    py27_0  
argcomplete               1.0.0                    py27_1  
astropy                   1.1.2               np110py27_0  
babel                     2.2.0                    py27_0  
backports-abc             0.4                       <pip>
backports.ssl-match-hostname 3.4.0.2                   <pip>
backports_abc             0.4                      py27_0  
bash-kernel               0.4.1                     <pip>
bcolz                     1.0.0                     <pip>
beautifulsoup4            4.4.1                    py27_0  
bitarray                  0.8.1                    py27_0  
blaze                     0.9.1                    py27_0  
blaze-core                0.9.0                    py27_0  
bokeh                     0.11.1                   py27_0  
boto                      2.39.0                   py27_0  
bottleneck                1.0.0               np110py27_0  
bz2file                   0.98                     py27_0  
cairo                     1.12.18                       6  
cdecimal                  2.3                      py27_0  
cffi                      1.5.2                    py27_0  
chest                     0.2.3                    py27_0  
click                     6.6                       <pip>
click-plugins             1.0.3                     <pip>
cligj                     0.4.0                     <pip>
cloudpickle               0.1.1                    py27_0  
clyent                    1.2.1                    py27_0  
colorama                  0.3.7                    py27_0  
conda                     4.0.5                    py27_0  
conda-build               1.19.0                   py27_0  
conda-env                 2.4.5                    py27_0  
conda-manager             0.3.1                    py27_0  
configobj                 5.0.6                    py27_0  
contextlib2               0.5.1                     <pip>
cryptography              1.3                      py27_0  
curl                      7.45.0                        0  
cycler                    0.10.0                   py27_0  
cyordereddict             1.0.0                     <pip>
cython                    0.23.4                   py27_0  
cytoolz                   0.7.5                    py27_0  
dask                      0.8.1                    py27_0  
datashape                 0.5.1                    py27_0  
dateutil                  2.4.1                    py27_0  
decorator                 4.0.9                    py27_0  
descartes                 1.0.2                     <pip>
dill                      0.2.4                    py27_0  
docutils                  0.12                     py27_0  
dynd                      0.7.3.dev1                <pip>
dynd-python               0.7.2                    py27_0  
enum34                    1.1.2                    py27_0  
et-xmlfile                1.0.1                     <pip>
et_xmlfile                1.0.1                    py27_0  
fastcache                 1.0.2                    py27_0  
filterpy                  0.1.2                     <pip>
fiona                     1.6.3.post1               <pip>
flask                     0.10.1                   py27_1  
flask-cors                2.1.2                    py27_0  
fontconfig                2.11.1                        5  
frb                       1.1.4                     <pip>
fred                      3.1                       <pip>
fredapi                   0.3.7                     <pip>
freetype                  2.5.5                         0  
funcsigs                  0.4                      py27_0  
futures                   3.0.3                    py27_0  
fysom                     2.1.2                     <pip>
gensim                    0.12.4              np110py27_0  
gevent                    1.1.0                    py27_0  
gevent-websocket          0.9.5                    py27_1  
greenlet                  0.4.9                    py27_0  
grin                      1.2.1                    py27_1  
h5py                      2.6.0               np110py27_1  
hdf5                      1.8.16                        0  
heapdict                  1.0.0                    py27_0  
httpretty                 0.8.14                   py27_0  
idna                      2.0                      py27_0  
ipaddress                 1.0.14                   py27_0  
ipykernel                 4.3.1                    py27_0  
ipyparallel               5.0.1                    py27_0  
ipython                   4.1.2                    py27_1  
ipython-genutils          0.1.0                     <pip>
ipython-notebook          4.0.4                    py27_0  
ipython-qtconsole         4.0.1                    py27_0  
ipython_genutils          0.1.0                    py27_0  
ipywidgets                4.1.1                    py27_0  
itsdangerous              0.24                     py27_0  
jbig                      2.1                           0  
jdcal                     1.2                      py27_0  
jedi                      0.9.0                    py27_0  
jinja2                    2.8                      py27_0  
joblib                    0.9.4                     <pip>
jpeg                      8d                            0  
jpype1                    0.6.1                     <pip>
jsonschema                2.4.0                    py27_0  
jupyter                   1.0.0                    py27_2  
jupyter-client            4.2.2                     <pip>
jupyter-console           4.1.1                     <pip>
jupyter-core              4.1.0                     <pip>
jupyter_client            4.2.2                    py27_0  
jupyter_console           4.1.1                    py27_0  
jupyter_core              4.1.0                    py27_0  
keras                     1.0.0                     <pip>
konlpy                    0.4.4                     <pip>
libdynd                   0.7.2                         0  
libffi                    3.0.13                        0  
libgfortran               3.0                           0  
libpng                    1.6.17                        0  
libsodium                 1.0.3                         0  
libtiff                   4.0.6                         1  
libxml2                   2.9.2                         0  
libxslt                   1.1.28                        0  
llvmlite                  0.9.0                    py27_0  
locket                    0.2.0                    py27_0  
logbook                   0.12.5                    <pip>
lxml                      3.6.0                    py27_0  
markupsafe                0.23                     py27_0  
matplotlib                1.5.1               np110py27_0  
meld3                     1.0.2                    py27_0  
mistune                   0.7.2                    py27_0  
mkl                       11.3.1                        0  
mkl-service               1.1.2                    py27_0  
mpmath                    0.19                     py27_0  
multipledispatch          0.4.8                    py27_0  
nbconvert                 4.1.0                    py27_0  
nbformat                  4.0.1                    py27_0  
networkx                  1.11                     py27_0  
nlpy                      0.0.9                     <pip>
nltk                      3.2                      py27_0  
nose                      1.3.7                    py27_0  
notebook                  4.1.0                    py27_1  
numba                     0.24.0              np110py27_0  
numexpr                   2.5                 np110py27_0  
numpy                     1.10.4                   py27_1  
odo                       0.4.2                    py27_0  
openpyxl                  2.3.2                    py27_0  
openssl                   1.0.2g                        0  
pandas                    0.18.0              np110py27_0  
partd                     0.3.2                    py27_1  
patchelf                  0.8                           0  
path.py                   8.1.2                    py27_1  
patsy                     0.4.0               np110py27_0  
pep8                      1.7.0                    py27_0  
pexpect                   4.0.1                    py27_0  
pickleshare               0.5                      py27_0  
pillow                    3.1.1                    py27_0  
pip                       8.1.1                    py27_1  
pixman                    0.32.6                        0  
ply                       3.8                      py27_0  
protobuf                  3.0.0b2                   <pip>
psutil                    4.1.0                    py27_0  
ptyprocess                0.5                      py27_0  
pudb                      2016.1                    <pip>
py                        1.4.31                   py27_0  
pyasn1                    0.1.9                    py27_0  
pycairo                   1.10.0                   py27_0  
pycosat                   0.6.1                    py27_0  
pycountry                 1.20                      <pip>
pycparser                 2.14                     py27_0  
pycrypto                  2.6.1                    py27_0  
pycurl                    7.19.5.3                 py27_0  
pyflakes                  1.1.0                    py27_0  
pygments                  2.1.1                    py27_0  
pymc                      2.3.6               np110py27_1  
pymc3                     3.0                       <pip>
pymongo                   3.0.3                    py27_0  
pyopenssl                 0.15.1                   py27_2  
pyparsing                 2.0.3                    py27_0  
pyproj                    1.9.5.1                   <pip>
pyqt                      4.11.4                   py27_1  
pytables                  3.2.2               np110py27_3  
pytest                    2.8.5                    py27_0  
python                    2.7.11                        0  
python-dateutil           2.5.1                    py27_0  
pytz                      2016.2                   py27_0  
pyyaml                    3.11                     py27_1  
pyzmq                     15.2.0                   py27_0  
qt                        4.8.7                         1  
qtawesome                 0.3.2                    py27_0  
qtconsole                 4.2.0                    py27_0  
qtpy                      1.0                      py27_0  
quandl                    2.8.9                     <pip>
readline                  6.2                           2  
redis                     2.6.9                         0  
redis-py                  2.10.3                   py27_0  
requests                  2.9.1                    py27_0  
rope                      0.9.4                    py27_1  
rpy2                      2.7.8                     <pip>
rtree                     0.8.2                     <pip>
scikit-image              0.12.3              np110py27_0  
scikit-learn              0.17.1              np110py27_0  
scipy                     0.17.0              np110py27_2  
seaborn                   0.7.0                    py27_0  
setuptools                20.6.7                   py27_0  
shapely                   1.5.15                    <pip>
simplegeneric             0.8.1                    py27_0  
singledispatch            3.4.0.3                  py27_0  
sip                       4.16.9                   py27_0  
six                       1.10.0                   py27_0  
smart-open                1.3.2                     <pip>
smart_open                1.3.2                    py27_0  
snowballstemmer           1.2.1                    py27_0  
sockjs-tornado            1.0.1                    py27_0  
sphinx                    1.3.5                    py27_0  
sphinx-rtd-theme          0.1.9                     <pip>
sphinx_rtd_theme          0.1.9                    py27_0  
spyder                    2.3.8                    py27_1  
spyder-app                2.3.8                    py27_0  
sqlalchemy                1.0.12                   py27_0  
sqlite                    3.9.2                         0  
ssl_match_hostname        3.4.0.2                  py27_0  
statsmodels               0.6.1               np110py27_0  
supervisor                3.1.3                    py27_1  
sympy                     1.0                      py27_0  
tables                    3.2.2                     <pip>
tensorflow                0.7.1                     <pip>
terminado                 0.5                      py27_1  
theano                    0.8.0                     <pip>
tk                        8.5.18                        0  
toolz                     0.7.4                    py27_0  
tornado                   4.3                      py27_0  
traitlets                 4.2.1                    py27_0  
unicodecsv                0.14.1                   py27_0  
urwid                     1.3.1                     <pip>
util-linux                2.21                          0  
virtualenv                13.0.1                   py27_0  
wbdata                    0.2.7                     <pip>
wbpy                      2.0.1                     <pip>
werkzeug                  0.11.4                   py27_0  
wheel                     0.29.0                   py27_0  
xlrd                      0.9.4                    py27_0  
xlsxwriter                0.8.4                    py27_0  
xlwt                      1.0.0                    py27_0  
xz                        5.0.5                         1  
yaml                      0.1.6                         0  
zeromq                    4.1.3                         0  
zipline                   0.9.0                     <pip>
zlib                      1.2.8                         0  

In [3]:
conda search --full-name python


Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ....
python                       1.0.1                         0  defaults        
                             2.6.8                         1  defaults        
                             2.6.8                         2  defaults        
                             2.6.8                         3  defaults        
                             2.6.8                         4  defaults        
                             2.6.8                         5  defaults        
                             2.6.8                         6  defaults        
                             2.6.8                         7  defaults        
                             2.6.9                         0  defaults        
                             2.6.9                         1  defaults        
                             2.7.3                         2  defaults        
                             2.7.3                         3  defaults        
                             2.7.3                         4  defaults        
                             2.7.3                         5  defaults        
                             2.7.3                         6  defaults        
                             2.7.3                         7  defaults        
                             2.7.4                         0  defaults        
                             2.7.5                         0  defaults        
                             2.7.5                         1  defaults        
                             2.7.5                         2  defaults        
                             2.7.5                         3  defaults        
                             2.7.6                         0  defaults        
                             2.7.6                         1  defaults        
                             2.7.6                         2  defaults        
                             2.7.7                         0  defaults        
                             2.7.7                         2  defaults        
                             2.7.8                         0  defaults        
                             2.7.8                         1  defaults        
                             2.7.9                         0  defaults        
                             2.7.9                         1  defaults        
                             2.7.9                        d1  defaults        [debug]
                             2.7.9                         2  defaults        
                             2.7.9                        d2  defaults        [debug]
                             2.7.9                         3  defaults        
                             2.7.10                        0  defaults        
                             2.7.10                       d0  defaults        [debug]
                             2.7.10                        1  defaults        
                             2.7.10                        2  defaults        
                          *  2.7.11                        0  defaults        
                             2.7.11                       d0  defaults        [debug]
                             3.3.0                      pro0  defaults        
                             3.3.0                      pro1  defaults        
                             3.3.0                         2  defaults        
                             3.3.0                         3  defaults        
                             3.3.0                         4  defaults        
                             3.3.1                         0  defaults        
                             3.3.2                         0  defaults        
                             3.3.2                         1  defaults        
                             3.3.3                         0  defaults        
                             3.3.4                         0  defaults        
                             3.3.5                         0  defaults        
                             3.3.5                         1  defaults        
                             3.3.5                         2  defaults        
                             3.3.5                         3  defaults        
                             3.3.5                         4  defaults        
                             3.4.0                         0  defaults        
                             3.4.1                         0  defaults        
                             3.4.1                         1  defaults        
                             3.4.1                         2  defaults        
                             3.4.1                         3  defaults        
                             3.4.1                         4  defaults        
                             3.4.2                         0  defaults        
                             3.4.3                         0  defaults        
                             3.4.3                         1  defaults        
                             3.4.3                         2  defaults        
                             3.4.4                         0  defaults        
                             3.5.0rc4                      0  defaults        
                             3.5.0                         0  defaults        
                             3.5.0                         1  defaults        
                             3.5.1                         0  defaults        

Python 인터프리터 동작 확인

$ python
Python 2.7.11 |Anaconda custom (64-bit)| (default, Dec  6 2015, 18:08:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>>
>>> exit()

IPython 콘솔 동작 확인

$ ipython
Python 2.7.11 |Anaconda custom (64-bit)| (default, Dec  6 2015, 18:08:32)
Type "copyright", "credits" or "license" for more information.

IPython 4.1.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:

In [1]: exit

Jupyter Qt 콘솔 동작 확인

  • X-window가 없는 리눅스 환경에서는 실행되지 않음
$ jupyter qtconsole &

또는

  • 모든 프로그램 > Anaconda2 > Jupyter QtConsole (windows)